package cn.tedu.personal_patient.information.dao.persist.repository.impl;

import cn.tedu.personal_patient.information.dao.persist.mapper.StaffMapper;
import cn.tedu.personal_patient.information.dao.persist.repository.IStaffRepository;
import cn.tedu.personal_patient.information.pojo.entity.Staff;
import cn.tedu.personal_patient.information.pojo.vo.StaffVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class StaffRepositoryImpl implements IStaffRepository {
    @Autowired
    private StaffMapper staffMapper;
    @Override
    public List<StaffVO> listById(Long id) {
        return staffMapper.listById(id);
    }
    @Override
    public StaffVO getById(Long id) {
        return staffMapper.selectById(id);
    }
    @Override
    public int updateById(Staff staff) {
        return staffMapper.updateById(staff);
    }

    @Override
    public int avatar(Staff staff) {
        return staffMapper.avatar(staff);
    }

  /*  @Override
    public int updateById(Staff staff) {
        return staffMapper.updateById(staff);
    }


    @Override

    public int countByPhoneAndNotId(String phone, Long id) {
        QueryWrapper<Staff> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("phone", phone);
        queryWrapper.ne("id", id);
        return staffMapper.selectCount(queryWrapper);
    }

    @Override
    public int countByHomeAddressAndNotId(String homeAddress, Long id) {
        QueryWrapper<Staff> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("homeAddress", homeAddress);
        queryWrapper.ne("id", id);
        return staffMapper.selectCount(queryWrapper);
    }*/

}
